package com.shop.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shop.entity.Goods;
import com.shop.entity.Page;
import com.shop.service.GoodsService;
import com.shop.service.impl.GoodsServiceImpl;

@WebServlet("/delete.do")
public class DeleteGoodsServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		GoodsService goodsService = new GoodsServiceImpl();
		Page page = null;
		int goodsId;
		try {
			goodsId = Integer.parseInt(req.getParameter("goodsId"));
			goodsService.deleteGoodsById(goodsId);
		} catch (Exception e) {
			System.out.println("删除失败");
		} 
		req.getRequestDispatcher("getGoods.do").forward(req, resp);
	}
}
